<?php
abstract class STE_Db
{
	protected $_db;
	
	public function __construct($db)
	{
		if (($db === null) || (!$db instanceof Zend_Db_Adapter_Abstract))
			throw new Exception("$db must be of type Zend_Db_Adapter_Abstract.");
		
		$this->_db = $db;
	}
	
	protected function _fetchStatement($query, $params)
	{
		try
		{
			$stmt = new Zend_Db_Statement_Mysqli($this->_db, $query);	
			$stmt->execute($params);
			$r = $stmt->fetchAll();	
			$stmt->closeCursor();
			return $r;
		} catch (Exception $ex) {
			throw $ex;
		}
	}
	
	protected function _executeStatement($query, $params)
	{
		try
		{
			$stmt = new Zend_Db_Statement_Mysqli($this->_db, $query);
			$r = $stmt->execute($params);
			$stmt->closeCursor();
			return $r;
		} catch (Exception $ex) {
			throw $ex;
		}
	}
	
	
}
?>